package cn.itcast.user.controller;

import cn.itcast.hmall.pojo.user.Address;
import cn.itcast.hmall.pojo.user.User;
import cn.itcast.user.service.AddressService;
import cn.itcast.user.service.UserService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/address")
@RestController
public class UserController {
    @Autowired
    private UserService userServicetwo;
    @Autowired
    private AddressService userService;
    @GetMapping("/uid")
    public List<Address> findUserById(){
        return userService.findUserById();
    }
    @GetMapping("/{addressId}")
    public Address findByAddressId(@PathVariable("addressId")String id){
        return userService.findByAddressId(id);
    }
    @GetMapping("/find")
    public User findUserBySystemId(@RequestParam("id")Long id){
        return userServicetwo.getById(id);
    }
    @PostMapping("/update")
    public void changeMonye(@RequestBody User user){
        userServicetwo.updateById(user);
    }
}
